package secretary;

import flexibility.userData;

public class checkClassRegex {

	userData classes = new userData();

	public checkClassRegex() {
		// this constructor will create the names of all applicable classes
		int prefix = 1;
		int suffix;
		String validClassName;
		// class are from the naming convention of '1A', where the number is the
		// class(kita alef), and the letter is
		// the class index (kita alef 1)

		for (int i = 0; i < 12; i++) {
			suffix = 65;
			for (int j = 0; j < 26; j++) {
				String aChar = new Character((char) suffix).toString();
				validClassName = prefix + aChar;
				suffix++;
				classes.addData(validClassName);

			}
			prefix++;
		}
	}

	public int checkClassRegex(String className) {
		// this will check the user input
		int valid = 0;
		if (className == null) {
			System.out.println("valid2");
			valid = 2;
		} else {
			for (int i = 0; i < classes.getLength(); i++) {
				if (className.equals(classes.getData(i).toString())) {
					valid = 1;
				}
			}
		}
		return valid;
	}

}
